package com.java123.web.t3.servlet;

/**
 * @author kevin
 */
import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

@WebServlet("/student/insert")
public class StudentServlet extends HttpServlet {
	
	@Override
	public void init() throws ServletException {
		System.out.println("init....");
		super.init();
	}
	
	private static final long serialVersionUID = -3552573023351694455L;

	@Override
	public void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		HttpSession session = request.getSession();
		String sessionId = session.getId();
		System.out.println("sessionId:" + sessionId);
		response.addCookie(new Cookie("test", "123"));
	}
	
	
	

}
